package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysACompanyListMapper;
import com.ruoyi.system.domain.SysACompanyList;
import com.ruoyi.system.service.ISysACompanyListService;
import com.ruoyi.common.core.text.Convert;

/**
 * 物业公司管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-08
 */
@Service
public class SysACompanyListServiceImpl implements ISysACompanyListService 
{
    @Autowired
    private SysACompanyListMapper sysACompanyListMapper;

    /**
     * 查询物业公司管理
     * 
     * @param companyNumber 物业公司管理主键
     * @return 物业公司管理
     */
    @Override
    public SysACompanyList selectSysACompanyListByCompanyNumber(String companyNumber)
    {
        return sysACompanyListMapper.selectSysACompanyListByCompanyNumber(companyNumber);
    }

    /**
     * 查询物业公司管理列表
     * 
     * @param sysACompanyList 物业公司管理
     * @return 物业公司管理
     */
    @Override
    public List<SysACompanyList> selectSysACompanyListList(SysACompanyList sysACompanyList)
    {
        return sysACompanyListMapper.selectSysACompanyListList(sysACompanyList);
    }

    /**
     * 新增物业公司管理
     * 
     * @param sysACompanyList 物业公司管理
     * @return 结果
     */
    @Override
    public int insertSysACompanyList(SysACompanyList sysACompanyList)
    {
        if(sysACompanyList.getCompanyNumber()==null||"".equals(sysACompanyList.getCompanyNumber())){
            String data = DateUtils.dateTime();
            String ranid = UUID.randomUUID().toString();
            String msg="CMNB"+data+ranid.substring(ranid.length()-5,ranid.length()-1);
            sysACompanyList.setCompanyNumber(msg);


        }
        return sysACompanyListMapper.insertSysACompanyList(sysACompanyList);
    }

    /**
     * 修改物业公司管理
     * 
     * @param sysACompanyList 物业公司管理
     * @return 结果
     */
    @Override
    public int updateSysACompanyList(SysACompanyList sysACompanyList)
    {
        return sysACompanyListMapper.updateSysACompanyList(sysACompanyList);
    }

    /**
     * 批量删除物业公司管理
     * 
     * @param companyNumbers 需要删除的物业公司管理主键
     * @return 结果
     */
    @Override
    public int deleteSysACompanyListByCompanyNumbers(String companyNumbers)
    {
        return sysACompanyListMapper.deleteSysACompanyListByCompanyNumbers(Convert.toStrArray(companyNumbers));
    }

    /**
     * 删除物业公司管理信息
     * 
     * @param companyNumber 物业公司管理主键
     * @return 结果
     */
    @Override
    public int deleteSysACompanyListByCompanyNumber(String companyNumber)
    {
        return sysACompanyListMapper.deleteSysACompanyListByCompanyNumber(companyNumber);
    }
}
